package com.neusoft.mapper;

import com.neusoft.po.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMapper {
    @Select("select * from user where userId=#{userId} and password=#{password}")
    public User getUserByIdByPass(User user);

    @Select("select count(*) from user where userId=#{userId}")
    public int getUserById(String userId);

    @Insert("insert into user values(#{userId},#{password},#{userName},#{userSex},null,1)")
    public int saveUser(User user);

    @Update("UPDATE user SET isvip = 1 WHERE userId = #{userId}")
	public int setVip(String userId);

	@Update("UPDATE user SET isvip = 0 WHERE userId = #{userId}")
	public int cancelVip(String userId);

	@Select("SELECT isvip FROM user WHERE userId = #{userId}")
	public int getIsVip(String userId);
}
